package Demo_Old.Demo;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

public class DateDemo {

    public static void main(String[] args) throws ParseException {

        Date date=new Date();
        System.out.println(System.currentTimeMillis());
        System.out.println(date);
        SimpleDateFormat simpleDateFormat=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        System.out.println(simpleDateFormat.format(date));
        Date date1=simpleDateFormat.parse("2020-12-20 10:10:10");
        System.out.println(date1);

        Calendar calendar=Calendar.getInstance();
        //calendar.setTime(date1);
        System.out.println(calendar.get(Calendar.DATE));
        System.out.println(calendar.getTimeInMillis());
        Date time = calendar.getTime();
        String format = simpleDateFormat.format(time);
        System.out.println(format);

    }
}
